package cn.kgc.myblog.controller;

import cn.kgc.myblog.entity.User;
import cn.kgc.myblog.service.UserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.Map;

/**
 * @author shkstart
 * @create 2020-01-02 14:39
 */
@RestController
public class UserController {

    @Resource
    private UserService userService;

    //登录账号
    @RequestMapping(value = "/loginByUser",produces = "application/json")
    public Map<String, Object> loginByUser(User user){
        Map<String, Object> map = userService.loginByUser(user);
        return map;
    }
    //注册
    @RequestMapping("/registerUser")
    public Map<String, Object> registerUser(User user){
        Map<String, Object> map = userService.insertUser(user);
        return map;
    }
}
